package com.wjjun.test.ui

import android.view.View
import com.wjjun.app.R
import androidx.databinding.ViewDataBinding
import com.wjjun.annotation.Print
import com.wjjun.base.ui.activity.BaseActivity
import com.wjjun.base.ui.activity.BaseBindingActivity
import com.wjjun.test.ui.viewmodel.TestBaseViewModel

class TestFragmentActivity : BaseBindingActivity<TestBaseViewModel, ViewDataBinding>(){

    @Print
    var index = 5;

    override fun getLayoutId(): Int {
        return R.layout.activity_test_fragment
    }

    override fun initParams() {
    }

    override fun initContent() {
        setSupportFragment(R.id.fl_content, TestFragment(index))
    }

    override suspend fun fetchData() {

    }

    override fun onClick(view: View) {
        when(view.id){
            R.id.btn_pre ->{ //前一个
                index--
            }
            R.id.btn_next->{//后一个
                index++
            }
        }
        setSupportFragment(R.id.fl_content, TestListFragment(index))
    }

    override fun onBackPressed() {
        this.finish()
    }
}